package com.starlight.ts_clouddev.infrastructure.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;

/**
 * 
 * @TableName cloud_role_authority
 */
@TableName(value ="cloud_role_authority")
@Data
public class CloudRoleAuthority implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 
     */
    private Date created;

    /**
     * 
     */
    private Date modified;

    /**
     * 角色id
     */
    private Long roleId;

    /**
     * 读取权限（对表信息的查看）
格式：精确到某表某字段，table:row，中间使用;间隔。
any表示所有
     */
    private String read;

    /**
     * 写入权限（对信息的直接更改）
     */
    private String write;

    /**
     * 执行权限（如执行删除用户等操作）
     */
    private String execute;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        CloudRoleAuthority other = (CloudRoleAuthority) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCreated() == null ? other.getCreated() == null : this.getCreated().equals(other.getCreated()))
            && (this.getModified() == null ? other.getModified() == null : this.getModified().equals(other.getModified()))
            && (this.getRoleId() == null ? other.getRoleId() == null : this.getRoleId().equals(other.getRoleId()))
            && (this.getRead() == null ? other.getRead() == null : this.getRead().equals(other.getRead()))
            && (this.getWrite() == null ? other.getWrite() == null : this.getWrite().equals(other.getWrite()))
            && (this.getExecute() == null ? other.getExecute() == null : this.getExecute().equals(other.getExecute()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCreated() == null) ? 0 : getCreated().hashCode());
        result = prime * result + ((getModified() == null) ? 0 : getModified().hashCode());
        result = prime * result + ((getRoleId() == null) ? 0 : getRoleId().hashCode());
        result = prime * result + ((getRead() == null) ? 0 : getRead().hashCode());
        result = prime * result + ((getWrite() == null) ? 0 : getWrite().hashCode());
        result = prime * result + ((getExecute() == null) ? 0 : getExecute().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", created=").append(created);
        sb.append(", modified=").append(modified);
        sb.append(", roleId=").append(roleId);
        sb.append(", read=").append(read);
        sb.append(", write=").append(write);
        sb.append(", execute=").append(execute);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}